package ilvonen.ihstatistics;


import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

	private Button btnNewGame;
	private Button btnStats;
	private Button btnSettings;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		btnNewGame = (Button)findViewById(R.id.btnNewGame);
		btnSettings = (Button)findViewById(R.id.btnSettings);
		btnStats = (Button)findViewById(R.id.btnStatistics);
		if(Globals.gameRunning){
			btnNewGame.setText(R.string.main_jatka_pelia);
		} else {
			btnNewGame.setText(R.string.main_uusi_peli);
		}
		btnNewGame.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if(Globals.gameRunning){
					Intent newIntent = new Intent(getApplication(), AddGameStats.class);
					newIntent.putExtra("gameid", Globals.gameId);
					startActivity(newIntent);
				}
				else{
					Intent newIntent = new Intent(getApplication(), NewGameSettings.class);
					newIntent.putExtra("accountId", 1);
					startActivity(newIntent);
				}
			}
		});
		
		
		btnSettings.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent newIntent = new Intent(getApplication(), SettingActivity.class);
				startActivity(newIntent);
			}
		});
		
		
		btnStats.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent newIntent = new Intent(getApplication(), StatisticsActivity.class);
				startActivity(newIntent);
			}
		});
	}
}
